#设置cmake最低版本
cmake_minimum_required(VERSION 3.4.1)

#设置项目名称
project(tst_qtbase_auto_gui)

#引入add_module模板文件
include(${ISSQTTESTROOTDIR}/cmake/add_module.cmake)

#设置测试类型，auto为自动测试，manual为手动测试,即test目录下的文件夹名
set(TEST_TYPE auto)
#设置模块名
set(MODULE qtbase)
#设置需要链接的模块
set(LinkQt Core Gui Widgets Network Concurrent OpenGL Sql Svg Quick Xml PrintSupport)
#设置需要链接的模块的私有模块
set(LinkQtPrivate Core Test Gui Widgets Sql Network OpenGL Concurrent PrintSupport)


add_definitions("-DQT_DISABLE_DEPRECATED_BEFORE=0"
                "-DSRCDIR=\"${CMAKE_CURRENT_SOURCE_DIR}/\"")
get_filename_component(CMAKE_NATIVE_MAKE_PROGRAM ${CMAKE_MAKE_PROGRAM} NAME)
add_definitions(-DDEFAULT_MAKESPEC="${CMAKE_NATIVE_MAKE_PROGRAM}")


set(CodeRootPath ${ISSQTTESTROOTDIR}/qtbase)
include_directories(${CodeRootPath}/3rdparty/tinycbor/src
                    ${CodeRootPath}/3rdparty/tinycbor/tests
                    ${CodeRootPath}/3rdparty/tinycbor/tests/encoder
                    ${CodeRootPath}/3rdparty/tinycbor/tests/parser
                    ${CodeRootPath}/tests/auto/other/qvariant_common
                    ${CodeRootPath}/tests/auto/corelib/kernel/qcoreapplication
                    ${CodeRootPath}/tests/baselineserver/shared
                    ${CodeRootPath}/tests/
                    ${CodeRootPath}/tests/auto/other/qabstractitemmodelutils
                    ${CodeRootPath}/tests/shared
                    ${CodeRootPath}/tests/auto/corelib/kernel/qmetatype)

#多级目录
set(TEST_ITEMS ${TEST_ITEMS}
	gui/image
	gui/itemmodels
	gui/kernel
	gui/qopengl
	gui/qopenglconfig
	gui/text
	gui/util
	gui/math3d
	gui/painting

	#其他测试项需要
	other/qabstractitemmodelutils
)

#排出不需要的.cpp
set(EXCLUDE_SRC ${EXCLUDE_SRC}
    #private test
    gui/image/qpixmapcache/tst_qpixmapcache.cpp
    gui/kernel/qguiapplication/tst_qguiapplication.cpp
    gui/painting/qpathclipper/tst_qpathclipper.cpp
    gui/text/qcssparser/tst_qcssparser.cpp
    gui/text/qfontcache/tst_qfontcache.cpp
    gui/text/qtextlayout/tst_qtextlayout.cpp
    gui/text/qtextodfwriter/tst_qtextodfwriter.cpp
    gui/text/qzip/tst_qzip.cpp
    #not win
    gui/kernel/noqteventloop/tst_noqteventloop.cpp
    #not test file
    gui/kernel/qfileopenevent/qfileopeneventexternal/qfileopeneventexternal.cpp
    #need QCoreApplication
    gui/text/qtextdocumentlayout/tst_qtextdocumentlayout.cpp
    gui/text/qtexttable/tst_qtexttable.cpp
    #need QApplication
    gui/kernel/qmouseevent_modal/tst_qmouseevent_modal.cpp
    gui/kernel/qtouchevent/tst_qtouchevent.cpp
    gui/text/qfont/tst_qfont.cpp
    gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp
    gui/text/qtextobject/tst_qtextobject.cpp
    gui/painting/qpainter/tst_qpainter.cpp
    gui/painting/qtransform/tst_qtransform.cpp
    gui/util/qtexturefilereader/tst_qtexturefilereader.cpp
    gui/painting/qcolor/tst_qcolor.cpp
    gui/painting/qregion/tst_qregion.cpp
    gui/kernel/qopenglwindow/tst_qopenglwindow.cpp
    gui/qopenglconfig/tst_qopenglconfig.cpp
    gui/text/qrawfont/tst_qrawfont.cpp
    gui/image/qpixmap/tst_qpixmap.cpp
    gui/image/qmovie/tst_qmovie.cpp

    #todo:cppcrash
    gui/text/qtextdocument/tst_qtextdocument.cpp                                    #NULL pointer dereferenc
)

add_sources(
    corelib/io/qsettings/tst_qsettings.cpp
    corelib/io/qsettings/qsettings.qrc
    corelib/thread/qfuture/tst_qfuture.cpp
    corelib/thread/qthreadpool/tst_qthreadpool.cpp
    corelib/tools/qpair/tst_qpair.cpp

    #todo
    corelib/io/qstandardpaths/tst_qstandardpaths.cpp
)

#0为使用widget_main，1为使用gui_main,2使用core_main,3使用appless_main，4或其他使用none_main
set(MANUAL_ADD_MAIN 1)

set(PLUGINS QOpenHarmonyPlatformIntegrationPlugin QJpegPlugin QWebpPlugin QWbmpPlugin QGifPlugin QICNSPlugin QTgaPlugin QTiffPlugin)
#再把TEST_ITEMS传给create_library整合测试项，生成测试库
#整合测试项，生成测试库，名字当前工程名，即project(tst_qtcharts_auto)中定义的tst_qtcharts_auto
create_library(${TEST_ITEMS})

